-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: Improve OpenShift provider connection validation using REST API #5074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Improve OpenShift provider connection validation using REST API #5074
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Duplicate Timezone in ISO 8601 Timestamp
The OpenshiftProvider generates malformed ISO 8601 timestamps for the kubectl.kubernetes.io/restartedAt annotation during rollout restarts. The code appends "Z" to a UTC datetime string that already includes a +00:00 timezone offset (e.g., 2025-06-15T10:30:00+00:00Z), resulting in an invalid format that combines both timezone indicators.
keep/providers/openshift_provider/openshift_provider.py#L457-L459
keep/keep/providers/openshift_provider/openshift_provider.py
Lines 457 to 459 in 5b6ae1d
| k8s_client = self.__get_k8s_client() | |
| now = datetime.datetime.now(datetime.timezone.utc) | |
| now = str(now.isoformat("T") + "Z") |
Bug: Inconsistent Data Format in Event Retrieval
The __get_events method in OpenshiftProvider returns an inconsistent data format: raw event objects when sorting is successful, but dictionaries otherwise. This is exacerbated by the sorting logic's use of getattr(event, sort_by, None), which can introduce None values into the sorting key, leading to unpredictable behavior or errors if sort_by is an invalid attribute.
keep/providers/openshift_provider/openshift_provider.py#L286-L300
keep/keep/providers/openshift_provider/openshift_provider.py
Lines 286 to 300 in 5b6ae1d
| if sort_by: | |
| self.logger.info(f"Sorting events by {sort_by}") | |
| try: | |
| sorted_events = sorted( | |
| events.items, | |
| key=lambda event: getattr(event, sort_by, None), | |
| reverse=True, | |
| ) | |
| return sorted_events | |
| except Exception: | |
| self.logger.exception(f"Error sorting events by {sort_by}") | |
| # Convert events to dict | |
| return [event.to_dict() for event in events.items] |
Bug: Global SSL Warning Suppression Causes Issues
The OpenshiftProvider uses warnings.filterwarnings('ignore', message='Unverified HTTPS request') for SSL warning suppression. This global setting affects the entire application, potentially hiding critical SSL warnings from other components, instead of being scoped to the specific OpenShift connection test.
keep/providers/openshift_provider/openshift_provider.py#L113-L116
keep/keep/providers/openshift_provider/openshift_provider.py
Lines 113 to 116 in 5b6ae1d
| # Suppress SSL warnings if insecure is True | |
| if self.authentication_config.insecure: | |
| # Suppress SSL verification warnings | |
| warnings.filterwarnings('ignore', message='Unverified HTTPS request') |
Was this report helpful? Give feedback by reacting with 👍 or 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
close #5072